package com.csw.android.ffmpegtest.gl.base

import android.content.res.AssetManager
import com.csw.android.ffmpegtest.audio.AudioTrackUtil

class GLV3Renderer {

    companion object {
        init {
            System.loadLibrary("GLV3Renderer-lib")
            System.loadLibrary("avcodec")
            System.loadLibrary("avfilter")
            System.loadLibrary("avformat")
            System.loadLibrary("avutil")
            System.loadLibrary("swresample")
            System.loadLibrary("swscale")
        }
    }

    external fun nativeOnSurfaceCreated()
    external fun nativeOnSurfaceChanged(width: Int, height: Int)
    external fun nativeOnDrawFrame()

    external fun clearColor(color: Int)
    external fun setViewPort(x: Int, y: Int, width: Int, height: Int)
    external fun clear(mash: Int)
    external fun setScene(sceneType: Int, assetManager: AssetManager)

    external fun setAssetManager(assetManager: AssetManager)
    external fun setRGBPicture(sceneType: Int, width: Int, height: Int, rgbBytes: ByteArray)
    external fun setYUVPicture(
        sceneType: Int,
        width: Int,
        height: Int,
        yData: ByteArray,
        yPixelStride: Int,
        uData: ByteArray,
        uPixelStride: Int,
        vData: ByteArray,
        vPixelStride: Int,
    )

    external fun setRotate(angle: Float)
    external fun playVideo(path: String, audioTrackUtil: AudioTrackUtil)
    external fun pauseVideo()

    external fun ffPrepare(path: String, audioTrackUtil: AudioTrackUtil)
    external fun ffPplay()
    external fun ffPause()
    external fun ffStop()

}